package com.version2_0.controller;

import com.version2_0.service.SearchService2_0;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * Created by reeveslee on 16/6/16.
 */
@Controller
public class SearchController2_0 {
    private static final Logger LOGGER = Logger.getLogger(SearchController2_0.class);

    @Autowired
    private SearchService2_0 searchService20;

    /**
     * 搜索界面
     *
     * @return
     */
    @RequestMapping(value = "/v2.0/search/page", method = RequestMethod.GET, produces = "application/json;charset=utf-8")
    @ResponseBody
    public String searchPage() {
        return searchService20.searchPage();
    }

    /**
     * 搜索
     *
     * @param key
     * @return
     */
    @RequestMapping(value = "/v2.0/search/{key}", method = RequestMethod.GET, produces = "application/json;charset=utf-8")
    @ResponseBody
    public String search(@PathVariable("key") String key) {
        return searchService20.search(key);
    }
}
